package com.zmj.sy.mom.srv.aps.controller;

import com.zmj.sy.mom.srv.aps.bean.vo.base.BaseIdReqVo;
import com.zmj.sy.mom.srv.aps.bean.vo.base.BaseListResVo;
import com.zmj.sy.mom.srv.aps.bean.vo.base.BaseResVo;
import com.zmj.sy.mom.srv.aps.bean.vo.search.*;
import com.zmj.sy.mom.srv.aps.service.SearchService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequiredArgsConstructor
@Api(tags = "查询")
@RestController
@RequestMapping("/search")
public class SearchController {

    private final SearchService searchService;

    @ApiOperation("生产订单详情-左侧树")
    @GetMapping("/tree")
    public BaseListResVo<SearchTreeResVo> tree(BaseIdReqVo reqVo) {
        return searchService.tree(reqVo);
    }

    @ApiOperation("生产订单详情-组件信息")
    @GetMapping("/component")
    public BaseListResVo<SearchComponentResVo> component(BaseIdReqVo reqVo) {
        return searchService.component(reqVo);
    }

    @ApiOperation("生产订单详情-零件信息")
    @GetMapping("/part")
    public BaseListResVo<SearchPartResVo> part(BaseIdReqVo reqVo) {
        return searchService.part(reqVo);
    }

    @ApiOperation("生产订单详情-工序信息")
    @GetMapping("/phase")
    public BaseListResVo<SearchPhaseResVo> phase(BaseIdReqVo reqVo) {
        return searchService.phase(reqVo);
    }

    @ApiOperation("生产订单详情-零件图纸")
    @GetMapping("/draw")
    public BaseResVo draw(BaseIdReqVo reqVo){
        return BaseResVo.ok(searchService.draw(reqVo));
    }

    @ApiOperation("生产订单详情-分包组件信息")
    @GetMapping("/packageComponent")
    public BaseListResVo<SearchComponentResVo> packageComponent(BaseIdReqVo reqVo) {
        return searchService.packageComponent(reqVo);
    }

    @ApiOperation("生产订单详情-分包零件信息")
    @GetMapping("/packagePart")
    public BaseListResVo<SearchPartResVo> packagePart(BaseIdReqVo reqVo) {
        return searchService.packagePart(reqVo);
    }

    @ApiOperation("生产订单详情-查询")
    @GetMapping("/find")
    public BaseListResVo<SearchFindResVo> find(SearchFindReqVo reqVo){
        return searchService.find(reqVo);
    }

}
